Works out where a point on the picture (x, y) appears on the screen, so a car or a pickup can be drawn on the road. True when the point is ahead of the camera and nearer than the horizon.
Game Boy: not available
Game Boy Color: not available
Sega Genesis: not built yet - The Sega Genesis will draw the road its own way.
On other consoles this differs: see Side by side and How the consoles differ.
perspective_floor_project(x, y) -> bool| Name | Type |
|---|---|
x | real |
y | real |
bool
Works out where a point on the picture (x, y) appears on the screen when the perspective floor is on, so a rival car or a pickup can be drawn on the road. It is true when the point is ahead of the camera and nearer than the horizon.
x and y are a place on the picture, counted from its top-left corner, the same numbers perspective_floor_camera takes.
The answers wait in four calls until the next perspective_floor_project: perspective_floor_screen_x and perspective_floor_screen_y (a screen position, counted from the screen's top-left pixel, where the thing touches the road) and perspective_floor_scale (how big to draw it). When it says false, perspective_floor_behind tells you which reason: behind the camera, or too far.
It uses the camera as it is now, so call it after the camera moved this frame.
// Draw event of a pickup standing on the road at (300, 640) on the picture.
if (perspective_floor_project(300, 640)) {
xscale = perspective_floor_scale();
yscale = xscale;
x = perspective_floor_screen_x();
y = perspective_floor_screen_y();
}When the spot is in front of the camera the instance is placed on it and sized to match; when it is behind the camera or past the horizon nothing changes.
Read the answer with perspective_floor_screen_x, perspective_floor_screen_y (a SCREEN position, counted from the screen’s top-left pixel, where the thing touches the road) and perspective_floor_scale (how big to draw it: 1 is the picture’s own size, 0.25 is a quarter of it, because things shrink toward the horizon). They keep the answer of the LAST call until the next one. When it says false, perspective_floor_behind tells you whether the point is behind the camera (it never will be on the screen) or too far (past the horizon, it is simply too small to draw). It uses the camera as it is now, so call it after the frame’s camera has moved.